*/
public $fileHandle;
+ /**
+ * Accessible via getConfig()
+ *
+ * @var Config
+ */
+ private $config;
+
/**
* Default constructor. Children should call this *first* if implementing
* their own constructors
$this->mDependantParameters = array_diff_key( $this->mParams, $this->mGenericParameters );
}
+ /**
+ * @since 1.24
+ * @return Config
+ */
+ public function getConfig() {
+ if ( $this->config === null ) {
+ $this->config = ConfigFactory::getDefaultInstance()->makeConfig( 'main' );
+ }
+
+ return $this->config;
+ }
+
+ /**
+ * @since 1.24
+ * @param Config $config
+ */
+ public function setConfig( Config $config ) {
+ $this->config = $config;
+ }
+
/**
* Run a child maintenance script. Pass all of the current arguments
* to it.
}
// Get an object to start us off
+/** @var Maintenance $maintenance */
$maintenance = new $maintClass();
// Basic sanity checks and such
$wgLocalisationCacheConf['storeClass'] = 'LCStoreNull';
}
}
+
+$maintenance->setConfig( ConfigFactory::getDefaultInstance()->makeConfig( 'main' ) );
$maintenance->finalSetup();
// Some last includes
require_once "$IP/includes/Setup.php";
$m2->simulateShutdown();
$this->assertOutputPrePostShutdown( "foobar\n\n", false );
}
+
+ /**
+ * @covers Maintenance::getConfig
+ */
+ public function testGetConfig() {
+ $this->assertInstanceOf( 'Config', $this->m->getConfig() );
+ $this->assertSame( ConfigFactory::getDefaultInstance()->makeConfig( 'main' ), $this->m->getConfig() );
+ }
+
+ /**
+ * @covers Maintenance::setConfig
+ */
+ public function testSetConfig() {
+ $conf = $this->getMock( 'Config' );
+ $this->m->setConfig( $conf );
+ $this->assertSame( $conf, $this->m->getConfig() );
+ }
}